package com.loadmore.common.image;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Priority;
import com.bumptech.glide.request.RequestOptions;
import com.loadmore.common.App;


/**
 * @author by sunleilei
 * @date 2017/9/27
 * @time 上午11:09
 */

public class ImageLoader {
    private Context context;
    private static ImageLoader mInstance;

    private ImageLoader(Context context) {
        this.context = context;
    }

    public static ImageLoader getInstance(Context context) {
        if (mInstance == null) {
            mInstance = new ImageLoader(context);
        }
        return mInstance;
    }

    public void loadImg(String url, ImageView imageView) {
        RequestOptions options = new RequestOptions()
                .centerCrop()
                .priority(Priority.HIGH);
        GlideApp.with(App.getApplication()).load(url).apply(options).dontAnimate().into(imageView);
    }
}
